<?
$formId = 'albumUpload';
$this->headerFixTop = false;
?>
<section class="navbar navbar-panel" data-spy="affix" data-offset-top="40">
	<div class="navbar-inner">
		<div>
			<div class="upload-panel">
				<a href="javascript:;" class="btn btn-success pull-left" id="addBtn"><span id="swfupload"></span>上传图片</a>
				<div class="divider-vertical pull-left"></div>
				<p class="navbar-text pull-left p5" id="uploadTip"></p> 
				<a href="javascript:;" class="btn btn-primary pull-right" disabled="" id="uploadBtn">确认上传</a> 
				
				
			</div>
		</div>
	</div>
</section>
<section>
	<? $form = $this->beginWidget('CActiveForm', array(
		'id' => $formId
	))?> 
		<div class="upload-queue-list p20 clearfix" id="uploadQueue">
			
		</div>
	<?$this->endWidget()?> 
	<div class="container">
		<form action="/Code/lamijie/index.php?r=album/upload&id=1&ajax=1" method="post" enctype ="multipart/form-data"> 
			<input type="file" name="Filedata"/>
			<button type="submit">提交</button>
		</form> 
	</div>
</section>

<script id="uploadQueuedTemplate" type="text/html">
<div class="queue" id="<%=fileID%>">
	<div class="queue-container">
		<div class="queue-head"></div>
		<div class="queue-body">
			<div class="photo-view">
				<img class="thumbnail" src="<?=Yii::app()->asset->getBaseAsset()?>/images/pages/album/no-pic.png" />
				<a id="removeBtn" class="" href="javascript:;" title="移除" data-alert="确认删除这张图片么?"></a>
				<a id="zoomBtn" class="icon-search" href="javascript:;" title="查看大图"></a>
				<a id="rotateBtn" class="icon-repeat" href="javascript:;" title="旋转 90°"></a>
			</div>
		</div>
		<div class="queue-foot">
			<div class="photo-status">
				<div class="progress progress-striped active mb0">
					<div class="bar" style="width: 1%;"></div>
				</div>
				<div class="status"></div>
			</div>
			<div class="photo-form">
				<?=$form->hiddenField($photo, 'path', array('id' => 'path'))?> 
				<?=$form->hiddenField($photo, 'rotate', array('id' => 'rotate'))?> 
				<?=$form->textField($photo, 'name', array('id' => 'name', 'placeholder' => '点此修改图片名称'))?> 
				<?=$form->textArea($photo, 'description', array('id' => 'description', 'placeholder' => '点此完善图片描述'))?> 
			</div>
		</div>
	</div>
</div>
</script>
<?
$sessionID = Yii::app()->session->getSessionID();
// uploadSettings = {
// 	id : 'addBtn',
// 	formData : {
// 		SESSIONID : '{$sessionID}'
// 	},
// 	uploadID: 'uploadBtn',
// 	formID: '{$formId}',
// 	queueID: 'uploadQueue',
// 	uploadLimit: $photo->maxInsert,
// 	uploader: '{$this->createUrl('/album/upload', array('id' => $aid, 'ajax' => 1))}',
// 	debug: G.DEBUG,
// 	buttonText: '选择照片'
// };
$script = <<<EOF
	uploadSetting = {
		file_upload_limit : $photo->maxInsert,
		button_placeholder_id : "swfupload",
		post_params: {
			SESSIONID : '$sessionID'
		},
		upload_url: '{$this->createUrl('/album/upload', array('id' => $aid, 'ajax' => 1))}'
	}
	Core.use('global', 'JS:pages/album/upload.js');
EOF;
Yii::app()->clientScript->registerScript($this->id, $script);
Yii::app()->clientScript->registerScriptFile('bootstrap-affix');
Yii::app()->clientScript->registerLessFile(Yii::getPathOfAlias('views.layouts.less.' . $this->module->id) . '/' . $this->id . '.less');
?>